<template>
	<view class="list-item">
		<image :src="item.image" mode="widthFix"></image>
		<view class="content">
			<text class="title">{{ item.title }}</text>
			<view class="btm">
				<text class="price">¥：{{ item.price.toFixed(2) }}</text>
				<uni-icons @click="handleClick(item)" type="cart" size="20"></uni-icons>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "list-item",
		props: {
			item: {
				type: Object,
				default: {}
			}
		},
		data() {
			return {

			};
		},
		methods: {
			handleClick(item) {
				this.$emit('addCarList', { ...item, count: 1 })
			}
		}

	}
</script>

<style lang="scss" scoped>
	.list-item {
		width: 100%;
		margin-bottom: 30rpx;
		border-radius: 20rpx;
		overflow: hidden;
		background-color: white;

		image {
			width: 100%;
		}

		.content {
			padding: 10rpx;

			.title {}

			.btm {
				display: flex;
				justify-content: space-between;
				align-items: center;

				.price {
					color: red;
					font-size: 40rpx;
				}
			}
		}

	}
</style>